package com.hnkywl.sts.entity.jhgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-4-2
 * Time: 下午2:25
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_BIZ_TPZJJH")
@Where(clause = "deleted!='1'")
public class Tpzjjh extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqTpzjjh", allocationSize = 1, sequenceName = "SEQ_BIZ_TPZJJH")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqTpzjjh")
    private Long id;
    //自购物资计划
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TPWZJH_ID")
    private Tpwzjh tpwzjh;
    //计划编号
    private String jhbh;
    // 资金计划（年）
    private String jhnf;
    // 资金计划（月）
    private String jhyf;
    //合计金额
    private Double sbje;
    // 供应商
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GYS_ID")
    private Qyjg gys;
    // 支付方式
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SJZDZ_ZFFS_ID")
    private Sjzdz zffs;
    // 申报公司
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBGS_ID")
    private Nbgs sbgs;
    // 申报部门
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBBM_ID")
    private Nbbm sbbm;
//    @ManyToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "SBJG_ID")
//    private Gsjg sbjg;
    // 申报人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg sbr;
    // 申报时间
    private Date sbrq = new Date();
    // 核定人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "HDR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg hdr;
    // 核定日期
    private Date hdrq;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "tpzjjh", targetEntity = Tpzjjhmx.class)
    @Where(clause = "deleted=0")
    private List<Tpzjjhmx> tpzjjhmxList;

    //借款单
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "zgzjjh", targetEntity = Jkd.class)
    @Where(clause = "deleted=0")
    private List<Jkd> jkdList;

    private String bz;

    //审批状态（已保存，已提交，已审批）   ybc ytj ysp
    private String zt = "ybc";

    // 关联流程
    @Column(name = "LC_ID")
    private String processInstanceId;

    //路径
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "Lj_ID")
    private Lj lj;


    public Lj getLj() {
        return lj;
    }

    public void setLj(Lj lj) {
        this.lj = lj;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Tpwzjh getTpwzjh() {
        return tpwzjh;
    }

    public void setTpwzjh(Tpwzjh tpwzjh) {
        this.tpwzjh = tpwzjh;
    }

    public String getJhbh() {
        return jhbh;
    }

    public void setJhbh(String jhbh) {
        this.jhbh = jhbh;
    }

    public String getJhnf() {
        return jhnf;
    }

    public void setJhnf(String jhnf) {
        this.jhnf = jhnf;
    }

    public String getJhyf() {
        return jhyf;
    }

    public void setJhyf(String jhyf) {
        this.jhyf = jhyf;
    }

    public Double getSbje() {
        return sbje;
    }

    public void setSbje(Double sbje) {
        this.sbje = sbje;
    }

    public Qyjg getGys() {
        return gys;
    }

    public void setGys(Qyjg gys) {
        this.gys = gys;
    }

    public Sjzdz getZffs() {
        return zffs;
    }

    public void setZffs(Sjzdz zffs) {
        this.zffs = zffs;
    }

    public Nbgs getSbgs() {
        return sbgs;
    }

    public void setSbgs(Nbgs sbgs) {
        this.sbgs = sbgs;
    }

    public Nbbm getSbbm() {
        return sbbm;
    }

    public void setSbbm(Nbbm sbbm) {
        this.sbbm = sbbm;
    }

    public Yg getSbr() {
        return sbr;
    }

    public void setSbr(Yg sbr) {
        this.sbr = sbr;
    }

    public Date getSbrq() {
        return sbrq;
    }

    public void setSbrq(Date sbrq) {
        this.sbrq = sbrq;
    }

    public Yg getHdr() {
        return hdr;
    }

    public void setHdr(Yg hdr) {
        this.hdr = hdr;
    }

    public Date getHdrq() {
        return hdrq;
    }

    public void setHdrq(Date hdrq) {
        this.hdrq = hdrq;
    }

    public List<Tpzjjhmx> getTpzjjhmxList() {
        return tpzjjhmxList;
    }

    public void setTpzjjhmxList(List<Tpzjjhmx> tpzjjhmxList) {
        this.tpzjjhmxList = tpzjjhmxList;
    }

    public List<Jkd> getJkdList() {
        return jkdList;
    }

    public void setJkdList(List<Jkd> jkdList) {
        this.jkdList = jkdList;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }
}
